export const crudOptions = (vm) => {
	return {
		pageOptions: {
			compact: true,
		},
		options: {
			rowId: "id",
			height: "100%", // 表格高度100%, 使用toolbar必须设置
			border: false,
		},
		rowHandle: {
			width: 20,
			view: {
				thin: true,
				text: "",
				show: false,
				disabled() {
					return !vm.hasPermissions("Retrieve");
				},
			},
			edit: {
				thin: true,
				text: "",
				show: false,
				disabled() {
					return !vm.hasPermissions("Update");
				},
			},
			remove: {
				thin: true,
				text: "",
				/* 	disabled() {
					return !vm.hasPermissions("Delete");
				}, */
			},
		},
		viewOptions: {
			componentType: "form",
		},
		formOptions: {
			appendToBody: true, // 子表格必须 否则弹出对话框无法显示最顶层
			defaultSpan: 24, // 默认的表单 span
			width: "35%",
		},
		columns: [
			{
				title: "关键词",
				key: "search",
				show: false,
				disabled: true,
				/* search: {
					disabled: false,
				}, */
				search: false,
				form: {
					disabled: true,
					component: {
						placeholder: "请输入关键词",
						props: {
							clearable: true,
						},
					},
				},
				view: {
					// 查看对话框组件的单独配置
					disabled: true,
				},
			},
			{
				title: "ID",
				key: "id",
				show: false,
				width: 90,
				form: {
					disabled: true,
				},
			},

			{
				title: "标签ID",
				key: "id_name",
				width: 90,
				type: "input",
				disabled: true,
				form: {
					disabled: true,
					component: {
						placeholder: "请输入标签ID",
					},
				},
			},
			{
				title: "标签名称",
				key: "name",
				width: 30,
				type: "input",
				form: {
					component: {
						placeholder: "请输入标签名称",
					},
				},
			},

			{
				title: "拥有此标签人数数量",
				key: "sum_num",
				width: 30,
				type: "input",
				form: {
					component: {
						placeholder: "请输入标签名称",
					},
				},
			},

			{
				title: "公众号ID",
				key: "official_account_management_id",
				width: 90,
				type: "input",
				disabled: true,
				form: {
					disabled: true,

					component: {
						placeholder: "请输入公众号ID",
					},
				},
			},
		],
	};
};
